Page({
    data: {
      count: 5,
      timer: null
    },
    onLoad() {
      let count = 5;
      this.setData({ count });
      this.data.timer = setInterval(() => {
        count--;
        this.setData({ count });
        if (count <= 0) {
          clearInterval(this.data.timer);
          wx.switchTab({ url: '/pages/my/my' });
        }
      }, 1000);
    },
    onUnload() {
      if (this.data.timer) clearInterval(this.data.timer);
    }
  });